package com.zoke.password.dialog;

import android.content.Context;
import android.support.annotation.NonNull;
import android.view.View;

import com.zoke.password.R;
import com.zoke.password.base.BaseDialog;

/**
 * Created by wulijie on 2018/6/2.
 */
public class NormalDialog extends BaseDialog implements View.OnClickListener {
    public NormalDialog(@NonNull Context context) {
        super(context);
        findViewById(R.id.tv_ok).setOnClickListener(this);
        findViewById(R.id.tv_cancel).setOnClickListener(this);
    }

    private OnViewListener mOkListener;

    @Override
    protected int getLayoutRes() {
        return R.layout.d_normal;
    }

    public NormalDialog setOk(OnViewListener clickListener) {
        this.mOkListener = clickListener;
        return this;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_cancel:
                dismiss();
                break;
            case R.id.tv_ok:
                if (mOkListener != null) mOkListener.onViewClick(v, this);
                break;
        }
    }

    public interface OnViewListener {
        void onViewClick(View view, BaseDialog dialog);
    }

}
